#ifndef _TTP229_H_
#define _TTP229_H_
#include <Arduino.h>
#define KEY_MAX 16
typedef struct
{
  String keyname;
  uint16_t keycode;
} ST_KEY_MAP;

typedef enum {
  EM_KEYCODE_1 = 0,
  EM_KEYCODE_2,
  EM_KEYCODE_3,
  EM_KEYCODE_4,
  EM_KEYCODE_5,
  EM_KEYCODE_6,
  EM_KEYCODE_7,
  EM_KEYCODE_8,
  EM_KEYCODE_9,
  EM_KEYCODE_0,
  EM_KEYCODE_A,
  EM_KEYCODE_B,
  EM_KEYCODE_C,
  EM_KEYCODE_D,
  IR_KEYCODE_STAR,
  IR_KEYCODE_POUND,
} E_EM_KEYCODE;

enum KEY{
  K0 = 0,
  K1 = 1,
  K2 = 2,
  K3 = 3,
  K4 = 4,
  K5 = 5,
  K6 = 6,
  K7 = 7,
  K8 = 8,
  K9 = 9,
  KA = 10,
  KB = 11,
  KC = 12,
  KD = 13,
  KE = 14,
  KF = 15,
 };
extern ST_KEY_MAP em_ttp_keymap[];

class TTP229 {
  private:
    uint8_t SCLPin, SDOPin; 
  public:
    void initTTP229(uint8_t SclPin, uint8_t SdoPin);
    uint16_t GetKeyCode(void);
    String GetKeyMap(void);
    uint16_t GetKey(void);
    String Read_Key (void);
    void  Set_password(KEY set_password_0, KEY set_password_1, KEY set_password_2);
    int Output_key(KEY task);
    int Password(void);
};
#endif  /* _KEYMAY_H_ */
